﻿<!DOCTYPE html>
<html lang="en">

<head>
    <title>hls直播流子冻播放例子</title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <style>
        #example {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
        }
    </style>

</head>

<body>
    <div id="example"></div>
    <script src="../build/three.js"></script>
    <script src="../build/mxreality.js"></script>
    <script src="../build/hls.js"></script>
    <script>


        window.onload = function () {
            init();
        }
        //var vr=new VR(scene,renderer,container);
        function init() {
            var scene, renderer;
            var container;
            //renderer = new THREE.WebGLRenderer();
            AVR.debug = true;
            renderer = new THREE.WebGLRenderer();
            renderer.setPixelRatio(window.devicePixelRatio);
            container = document.getElementById('example');
            container.appendChild(renderer.domElement);


            scene = new THREE.Scene();

            // fov 选项可调整初始视频远近
            var vr = new VR(scene, renderer, container, { "fov": 50 });

            //vr.playText="<img src='img/play90.png' width='40' height='40'/>";
            vr.vrbox.radius = 600;

            // 初始化播放参数
            vr.playCfg.muted = true;
            vr.playCfg.autoplay = true;

            if (AVR.isCrossScreen()) {
                // 调整vr视窗偏移量
                vr.effect.separation = 1.2;
            }
            vr.loadProgressManager.onLoad = function () {
                // 视频静音

            }
            //AVR.useGyroscope=false;
            vr.init(function () {

            });

            // 运行时自动播放参数(初始化播放参数设置后这里可不选，选择后覆盖初始化参数)
            var options = { 'muted': true, 'autoplay': true };
            vr.playPanorama('http://ivi.bupt.edu.cn/hls/cctv5phd.m3u8', vr.resType.sliceVideo, options);
            vr.video.setAttribute("loop", "loop");
            vr.video.crossOrigin = "Anonymous";

            vr.video.onended = function () {
            }

        }


    </script>
</body>

</html>